//
//  ZGLTeamScoreCell.m
//  ZeegingLottery
//
//  Created by 蒂埃里 on 2018/11/1.
//  Copyright © 2018 蒂埃里. All rights reserved.
//

#import "ZGLTeamScoreCell.h"

@interface ZGLTeamScoreCell ()

@property (weak, nonatomic) IBOutlet UILabel *rank;        //排名
@property (weak, nonatomic) IBOutlet UILabel *teamName;
@property (weak, nonatomic) IBOutlet UILabel *matchCount;
@property (weak, nonatomic) IBOutlet UILabel *winCount;
@property (weak, nonatomic) IBOutlet UILabel *goalCount;
@property (weak, nonatomic) IBOutlet UILabel *score;
@property (weak, nonatomic) IBOutlet UIImageView *icon;

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *countWwin;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *winWgoal;


@end

@implementation ZGLTeamScoreCell


+ (instancetype)teamScoreCell
{
    return [[[NSBundle mainBundle] loadNibNamed:@"ZGLTeamScoreCell" owner:nil options:nil]lastObject];;
    
}

- (void)setModel:(ZGLScoreBoardTeamModel *)model
{
    _model = model;
    
    self.rank.text = model.team_order;
    self.teamName.text = model.team_cn;
    self.matchCount.text = model.count;
    
    NSString *winStr = [NSString stringWithFormat:@"%@/%@/%@",model.win,model.draw,model.lose];
    self.winCount.text = winStr;
    
    NSString *goalStr = [NSString stringWithFormat:@"%@/%@",model.goal,model.losegoal];
    self.goalCount.text = goalStr;
    
    self.score.text = model.score;
    
    NSURL *url = [NSURL URLWithString:model.logo];
    [self.icon sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"teamLogo_default"]];
    
    
    
    
}




- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.rank.font = kFONT_SIZE(13);
    self.teamName.font = kFONT_SIZE(13);
    self.matchCount.font = kFONT_SIZE(13);
    self.winCount.font = kFONT_SIZE(13);
    self.goalCount.font = kFONT_SIZE(13);
    self.score.font = kFONT_SIZE(13);
    
    if (IS_IPHONE_4and5) {
        self.winWgoal.constant = 3;
        self.countWwin.constant = 3;
    }
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
